<?php
	error_reporting(0);
	session_start();
?>
<!DOCTYPE HTML>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>商品详情页 - 一书网</title>
	<link rel="stylesheet" type="text/css" href="style/book_detail.css">
</head>
<body>
	<div class="wrapper clr">
		<div class="logo-search">
			<div class="logo">
				<img src="images/logo.png" title="欢迎来到一书网" alt="一书网" />
			</div>
			<div class="search">
				<input class="input" type="text" />
				<input class="button" type="button" value="Search"/>
			</div>
		</div>
		<div class="nav">
			<ul>
				<a href="index.php"><li>首　　页</li></a>
				<a href="#"><li>古典文学</li></a>
				<a href="#"><li>生活杂志</li></a>
				<a href="#"><li>艺术书籍</li></a>
				<a href="#"><li>关于我们</li></a>
			</ul>
		</div>
	</div>	
	<hr class="body-hr" />
	<div class="content">
		<?php 
			// 1、导入数据库连接文件
			include 'link.php';
			
			// 2、从url中获取ISBN的值
			$isbn = $_GET['isbn'];
			
			// 3、执行查询
			$sql = "select * from books where ISBN={$isbn} limit 1";
			$result = mysqli_query($link, $sql);
			$rows = mysqli_fetch_array($result);
	    ?>
		<h3>书籍详情</h3>
		<div class="book-img">
			<img src="<?php echo $rows['img_path'] ?>" alt="<?php echo $rows['book_name'] ?>">
		</div>
		<div class="book-info">
			<div class="book-name">
				书名：<span class="book-name-span"><?php echo $rows['book_name'] ?></span>
			</div>
			<div class="author">
				作者：<span class="author-span"><?php echo $rows['author'] ?></span>
			</div>
			<div class="press-title">
				出版社：<span class="press-title-span"><?php echo $rows['press_title'] ?></span>
			</div>
			<div class="press-date">
				出版日期：<span class="press-date-span"><?php echo $rows['press_date'] ?></span>
			</div>
			<div class="price">
				定价：<span class="price-span">￥<?php echo $rows['price'] ?></span>
			</div>
			<div class="buy">
				<form action="handle_orders.php?isbn=<?php echo $isbn; ?>" method="post">
					<div class="num">
						<input class="sub" type="button" value="-" onclick="Sub();" /> 
						<input id="num" class="order-num" type="text" value="1" name="order_num" />
						<input class="add" type="button" value="+"  onclick="Add();" />
					</div>
					<div class="button">
						<input class="submit-buy" name="submit-buy" type="submit" value="立即购买" />
						<input class="submit-add" type="submit" value="添加到购物车" />
					</div>
				</form>
			</div>
		</div>	
	</div>

	<!-- start footer -->
	<div class="footer">
		<div class="footer-content">
			<div class="link">
				<h4>友情链接</h4>
				<ul>
					<li><a href="#">Amazon</a></li>
					<li><a href="#">淘宝网</a></li>
					<li><a href="#">读书网</a></li>
					<li><a href="#">中国图书网</a></li>
				</ul>
			</div>

			<div class="about">
				<h4>关于我们</h4>
				<ul>
					<li><a href="#">关于一书</a></li>
					<li><a href="#">加入我们</a></li>
					<li><a href="#">联系方式</a></li>
					<li><a href="#">打赏一下</a></li>
				</ul>
			</div>

			<div class="copy">
				<h4>版权信息</h4>
				<p>
					Copyright &copy; ebook 2016 - 2017 <br />
					最终解释权归一书网所有
				</p>
			</div>
		</div>
	</div>
	<script type="text/javascript" src="js/book_detail.js"></script>
</body>
</html>